<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary 
    x:Class="OpenLS.Spreadsheet.UI.TableStyleResources"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
    xmlns:drawingui="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals">
    <DataTemplate DataType="{x:Type ssui:TableStyleCell}">
        <Grid >
            <Grid.Background>
                <MultiBinding >
                    <MultiBinding.Converter>
                        <ssui:TableInfoToBackgroundConverter/>
                    </MultiBinding.Converter>
                    <Binding Path="Row"/>
                    <Binding Path="Column"/>
                    <Binding Path="Style"/>
                    <Binding RelativeSource="{RelativeSource Self}"  Path="(drawingui:DrawingElement.ColorScheme)"/>
                </MultiBinding>
            </Grid.Background>
            <Line X2="7"  StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Line.Stroke>
                    <MultiBinding >
                        <MultiBinding.Converter>
                            <ssui:TableInfoToForegroundConverter/>
                        </MultiBinding.Converter>
                        <Binding Path="Row"/>
                        <Binding Path="Column"/>
                        <Binding Path="Style"/>
                        <Binding RelativeSource="{RelativeSource Self}"  Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>

                </Line.Stroke>
            </Line>
        </Grid>

    </DataTemplate>
    <DataTemplate DataType="{x:Type ss:TableStyle}">
        <ItemsControl Width="60" Height="45">
            <ItemsControl.ItemsSource>
                <Binding>
                    <Binding.Converter>
                        <ssui:TableStyleCellFactory/>
                    </Binding.Converter>
                </Binding>
            </ItemsControl.ItemsSource>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemContainerStyle>
                <Style>
                    <Setter Property="Grid.Row" Value="{Binding Row}"></Setter>
                    <Setter Property="Grid.Column" Value="{Binding Column}"></Setter>
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl>
    </DataTemplate>
    <DataTemplate DataType="{x:Type ss:TableStyle}" x:Key="obsolete">
        <Grid Width="50" Height="40">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.Background>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="WholeTable"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Grid.Background>
            <Rectangle Grid.RowSpan="5" Grid.Column="1">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="FirstColumnStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>

            <Rectangle Grid.RowSpan="5" Grid.Column="3">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="FirstColumnStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.RowSpan="5" Grid.Column="2">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="SecondColumnStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>

            <Rectangle Grid.ColumnSpan="5">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="HeaderRow"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.ColumnSpan="5" Grid.Row="4">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="TotalRow"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.ColumnSpan="5" Grid.Row="1">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="FirstRowStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.ColumnSpan="5" Grid.Row="2">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="SecondRowStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.ColumnSpan="5" Grid.Row="3">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.TableStyleElementToBackgroundConverter}">
                        <Binding Path="FirstRowStripe"></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawingui:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
        </Grid>
    </DataTemplate>
    
</ResourceDictionary>